#ifndef _LIBUTILS_H_
#define _LIBUTILS_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>

typedef unsigned char __u8;
typedef unsigned short __u16;
typedef unsigned int __u32;
typedef unsigned long long __u64;

typedef char __i8;
typedef short __i16;
typedef int __i32;
typedef long long __i64;

/* generate a random integer number in (start, end) */
int uniform_integer(int start, int end);

/* generate a random in (0, 100) */
int get_random(void);

/* caclucate checksum */
int get_cs(void *buf, int len);	

/* bin to 8421BCD */
int bin2bcd(int bin);

/* 8421BCD to bin*/
int bcd2bin(int bcd);

/* dump mem */
void mem_dump(void *buf, int len);

/* convert time array to time_t 
** ssmmhhDDMMYY->time_t
*/
time_t unix_time(unsigned char *ptime);

int str2hex(__u8 *asc, __u8* hex, int len);

#endif

